import java.io.*;
import java.util.*;

public class test3 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("Java_11_16\\d.txt");
        int len;
        byte[] chars = new byte[1024];
        len = fis.read(chars);
        String t = new String(chars,0,len);
        String[] str = t.split("-");
        ArrayList<Integer> arr = new ArrayList<>();
        for (String s : str) {
            arr.add(Integer.parseInt(s));
        }
        Collections.sort(arr);
        FileWriter fw = new FileWriter("Java_11_16\\e.txt");
        for (int i = 0; i < arr.size(); i++) {
            fw.write(arr.get(i) + "");
            if(i != arr.size()-1) {
                fw.write('-');
            }
        }
        fw.close();
        fis.close();
    }
}
